package com.xbao.service.impl;

import com.github.pagehelper.PageHelper;
import com.xbao.core.http.CommRequest;
import com.xbao.core.util.MyBeanUtil;
import com.xbao.dao.MAnswerMapper;
import com.xbao.model.MAnswer;
import com.xbao.model.MAnswerExample;
import com.xbao.model.MVideo;
import com.xbao.model.MVideoExample;
import com.xbao.model.req.MAnswerReq;
import com.xbao.model.req.MVideoReq;
import com.xbao.model.vo.MVideoVo;
import com.xbao.service.MAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MAnswerServiceImpl implements MAnswerService {
    @Autowired
    private MAnswerMapper mAnswerMapper;
    @Override
    public List<MAnswer> getAnswers(CommRequest<MAnswerReq> mVideoReqCommRequest) {
        MAnswerExample mExample = new MAnswerExample();
        MAnswerReq mReq=mVideoReqCommRequest.getData();
        MAnswerExample.Criteria criteria = mExample.createCriteria();
        if (mReq.getPager() != null) {
            PageHelper.startPage(mReq.getPager().getPageNo(), mReq.getPager().getPageSize());
            mExample.setOrderByClause("id desc");
        }
        List<MAnswer> ms = mAnswerMapper.selectByExample(mExample);
        return ms;
    }
}
